const PropService = require("../../services/admin/PropService")
const PropController = {
    add:async(req,res)=>{
        console.log("这个body数据:",req.body)
        const {propname,propnumber,propemail,building,roomnumber,roomarea} = req.body
        // 调用servise模块更新数据
        await PropService.add(
            {propname,
            propnumber:Number(propnumber),
            propemail,
            building,
            roomnumber,
            roomarea:Number(roomarea)},
            res.send({
                ActionType:"ok",  
            })
            )
        // await PropService.add()
        //     res.send({
        //         ActionType:"ok",
                
        //     })
    },
    getList:async(req,res)=>{
        const result = await PropService.getList(req.params)
        console.log(result)
        res.send({
            ActionType:"ok",
            data:result
        })
    }, 
    delList:async(req,res)=>{
        // console.log(req.params.id)
        const result = await PropService.delList({_id:req.params.id})
        res.send({
            ActionType:"delok",
        })
    },
    putList:async(req,res)=>{
        // console.log("更新的人是：",req.body)
        const result = await PropService.putList(req.body)
        
        res.send({
            ActionType:"ok",
        })
    }, 
    addaccount:async(req,res)=>{
        const result = await PropService.addaccount(req.body)
        res.send({
            ActionType:"ok",
        })
    },
    getaccount:async(req,res)=>{
        const result = await PropService.getaccount(req.params)
        console.log(result)
        res.send({
            ActionType:"ok",
            data:result
        })
    },
    putaccount:async(req,res)=>{
        const result = await PropService.putaccount(req.body)
        res.send({
            ActionType:"ok",
        })
    },
    delaccount:async(req,res)=>{
        const result = await PropService.delaccount({_id:req.params.id})
        res.send({
            ActionType:"delok",
        })
    },
    

}
module.exports = PropController
